function ifempty(el){
            if (el.value != "") {
                $(el).parent().children("span").css("display","none");
                return true;
            }else{
                $(el).parent().children("span").css("display","inline-block");
                return false;
            }
    }
EventUtil.addHandler(window, "load", function(){
       var enterButton = getEl("enterButton");
        EventUtil.addHandler(enterButton, "click", function(){
            var imput_name = document.getElementsByName("m_name")[0];
            var imput_password = document.getElementsByName("m_password")[0];

            var bool_name = ifempty(imput_name);
            var bool_password = ifempty(imput_password);
            if(bool_name && bool_password){
                var m_name = imput_name.value;
                var m_password = imput_password.value;
                }
                
                    var info = {
                    m_name: m_name,
                    m_password: m_password,
                    };
                    AjaxIO.post("/user/login",info,
                        function (result) {
                            
                            if (result.data.token) {
                            localStorage.setItem("m_id",result.data.m_id[0]);   
                            localStorage.setItem("token",result.data.token);
                            location.href = "firstpage.html";
                            }
                        },function(result)
                        {



                            if(result.status==404)
                                $.toast("用户名不存在");
                            if(result.status==403)
                                $.toast("密码不正确");

                                   

                        }

                            );
                        


                
            });

          
		});
